package com.pro.springbootshop.controller;

import com.pro.springbootshop.entity.ExtendOrders;
import com.pro.springbootshop.service.ExtendOrdersService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ExtendOrdersController {
    @Autowired
    ExtendOrdersService extendOrdersService;
    @ApiOperation("获取所包含的订单信息")
    @GetMapping("/api/extendOrders/{ordersId}")
    public List<ExtendOrders> getExtendOrders(@PathVariable(name="ordersId") Integer ordersId){
        return extendOrdersService.getExtendOrders(ordersId);
    }
    @ApiOperation("修改所包含的订单状态")
    @PostMapping("/api/extendOrders/change/{ordersId}")
    public String changOrdersByExtendOrders(@PathVariable(name="ordersId") Integer ordersId){
        return extendOrdersService.changOrdersByExtendOrders(ordersId);
    }
    @ApiOperation("根据订单id获取扩展订单id")
    @GetMapping("/api/extendOrders/orders/{orderId}")
    public Integer getExtendOrdersId(@PathVariable(name="orderId") Integer orderId){
        return extendOrdersService.getExtendOrdersId(orderId);
    }
}
